package org.qpcr.community.project.web.excel.sequence.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

/**
 * 步骤类型
 * @author yanss
 * @since 2024/6/26 14:36
 */
@Getter
public enum SeqType {
    CONSTANT("1","恒温段"),
    VARYING("2","变温段"),
    MELTING("3","熔解段");

    private final String code;
    @JsonValue
    private final String name;

    SeqType(String code, String name){
        this.code = code;
        this.name = name;
    }

    @JsonCreator
    public static SeqType getConstantByEnumName(String enumName) {
        for (SeqType enumConstant : SeqType.values()) {
            if (enumConstant.name().equals(enumName) || enumConstant.code.equals(enumName) || enumConstant.name.equals(enumName)) {
                return enumConstant;
            }
        }
        return null;
    }

}
